//
//  ViewController.m
//  LBTagsView
//
//  Created by 刘文扬 on 2017/9/20.
//  Copyright © 2017年 lianj. All rights reserved.
//

#import "ViewController.h"
#import "LBTagsView.h"
#import <Masonry.h>

@interface ViewController ()

/** LBTagsView*/
@property(nonatomic,strong)LBTagsView *tagView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.tagView];
    
    [self.tagView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.offset(100);
        make.trailing.offset(-100);
    }];
    
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.tagView.dataSource = @[@"哈哈",@"哈哈哈哈",@"哈哈",@"哈哈",@"哈哈哈哈",@"哈哈",@"哈",@"哈哈哈哈",@"哈哈哈哈哈哈"];
        [self.tagView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.trailing.offset(-20);
        }];
    });
    
    
    // Do any additional setup after loading the view, typically from a nib.
}

-(LBTagsView *)tagView
{
    if (_tagView == nil) {
        
        
        _tagView = [[LBTagsView alloc] initWithLimitedWidth:0 textFont:[UIFont systemFontOfSize:15] textColor:[UIColor redColor] leftAndRightMargin:5 itemMargin:5 rowMargin:5 data:@[@"哈哈",@"哈哈哈哈",@"哈哈",@"哈",@"哈哈哈哈",@"哈哈哈哈哈哈"] backgroundImage:nil imageEdgeInsets:UIEdgeInsetsZero];
        _tagView.backgroundColor = [UIColor yellowColor];
        
    }
    return _tagView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
